package com.forever.jodd;

import java.util.HashMap;
import java.util.Map;

import jodd.util.StringTemplateParser;
import jodd.util.StringTemplateParser.MacroResolver;

public class StringTemplate {

	public static void main(String[] args) {
		String template = "Hello ${foo}. Today is ${dayName}.";

		final Map<String, String> map = new HashMap<String, String>();
		map.put("foo", "Jodd");
		map.put("dayName", "Sunday");

		StringTemplateParser stp = new StringTemplateParser();
		String result = stp.parse(template, new MacroResolver() {
			public String resolve(String macroName) {
				return map.get(macroName);
			}
		});
		System.out.println("result:" + result);
	}
}